package api.dataStruct
{
	public class SetStruct
	{
		
		public static function setObjData(mainObj:*,Obj:Object):void{
			
			if(!mainObj||!Obj){
				return
			}
			for(var i:* in Obj){
				if(Obj[i] is Array){
					if(Obj[i].length>0){
						if(isHasObj(Obj[i])){
							mainObj["set"+i](Obj[i].length)
							for(var n:int=0;n<Obj[i].length;n++){
								if(Obj[i][n] is Array){
									
								}else if(Obj[i][n] is Object){
									
									setObjData(mainObj[i][n],Obj[i][n])
								}
							}
						}else{
							mainObj[i]=Obj[i]
						}
					}
				}else if(typeof(Obj[i])=="object"){
					setObjData(mainObj[i],Obj[i])
				}else{
					
					mainObj[i]=Obj[i]
				}
			}
		}
		public static function  isHasObj(Obj:Array):Boolean{
			var isHas:Boolean=false
			if(typeof(Obj[i])=="object"){
				return true
			}
			
			for(var i:* in Obj){
				
				if(Obj[i] is Array){
					isHas=isHasObj(Obj[i])
					
				}else if(typeof(Obj[i])=="object"){
					isHas= true
					
				}
			}
			return isHas
		}
	}
}